package com.itheima.homework4.comparable;

import java.util.TreeSet;

public class Test1 {
    public static void main(String[] args) {
        //创建TreeSet集合对象
       TreeSet<Student1> ts1 = new TreeSet<>();
       //Student1的有参构造创建对象
       Student1 s1 = new Student1("Tom",20,90);
       Student1 s2 = new Student1("Jerry",22,95);
       Student1 s3 = new Student1("John",20,100);
       Student1 s4 = new Student1("Lily",22,100);
       Student1 s5 = new Student1("Lucy",22,90);
       Student1 s6 = new Student1("Kevin",22,90);
       //添加元素
       ts1.add(s1);
       ts1.add(s2);
       ts1.add(s3);
       ts1.add(s4);
       ts1.add(s5);
       ts1.add(s6);
       //遍历
        for (Student1 student1 : ts1) {
            System.out.println(student1);

        }


    }
}
